package task1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-05-12
 * Time:12:48
 */
public class Rectangle extends Shape{
    public double width;
    public double height;

    public Rectangle(String color, double width, double height) {
        super(color);
        this.width = width;
        this.height = height;
    }

    @Override
    public double getArea() {
        return this.width*this.height;

    }

    @Override
    public double getPer() {
        return(2*(this.width+this.height));
    }

    @Override
    public String toString() {
        return "Rectangle{" +
                "width=" + width +
                ", height=" + height +
                ", area=" + this.getArea() +
                ", per=" + this.getPer() + '\'' +
                '}';
    }

    @Override
    public void shoeAll() {
        System.out.println(this.toString());
    }
}
